home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group93c.txt / 000002_icon-group-sender _Wed Jun 30 16:12:52 1993.msg < prev    next >
Internet Message Format  |  1994-02-02  |  1KB

  1. Received: from owl.CS.Arizona.EDU by cheltenham.CS.Arizona.EDU; Wed, 30 Jun 1993 18:02:39 MST
  2. Received: by owl.cs.arizona.edu; Wed, 30 Jun 1993 18:02:38 MST
  3. Date: Wed, 30 Jun 1993 16:12:52 MST
  4. From: "Clint Jeffery" <cjeffery>
  5. Message-Id: <199306302312.AA27120@chuckwalla.cs.arizona.edu>
  6. To: Paul_Abrahams@MTS.cc.Wayne.edu
  7. Cc: icon-group@cs.arizona.edu
  8. In-Reply-To: Paul_Abrahams@MTS.cc.Wayne.edu's message of Wed, 30 Jun 93 16:35:14 EDT <692691@MTS.cc.Wayne.edu>
  9. Subject: Re: Tables versus lists
  10. Status: R
  11. Errors-To: icon-group-errors@cs.arizona.edu
  12.  
  13.    Paul Abrahams writes, regarding:
  14.  
  15.      push(array, element)
  16.    versus
  17.      array[integer(*array+1)] := element
  18.  
  19.    My question is: how do the efficiencies of these constructs compare?
  20.  
  21. Why not run timings and tell us?  Detailed knowledge of the implementation
  22. helps make guesses, but in Icon the measured results often bely intuition.
  23.  
  24. Regarding the implementation, the "linked list" that is traversed for each
  25. list index operation is typically only of length log(*L) and performs very
  26. well.  But the implementation of tables in Icon is awfully clever (thanks
  27. to Bill Griswold and Gregg Townsend).  My intuition is that the cost of the
  28. integer(*array+1) expression is what turns the tables.  By the way, do you
  29. really need that function call to integer() there?
  30.  
  31. Clint Jeffery
  32.